<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('选择字段枚举')" />
</head>

<body class="gray-bg">
	<div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="role-form">
				    <input type="hidden" id="dictId" name="dictId" th:value="${dictId}">
					<div class="select-list">
						<ul>
							<li>
								字典名称：<input type="text" name="dictName"/>
							</li>
							<li>
								字典类型：<input type="text" name="dictType"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
	        
	        <div class="col-sm-12 select-table table-striped">
			    <table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
	<th:block th:include="include :: footer" />
	<script th:inline="javascript">
		var datas = [[${@dict.getType('sys_normal_disable')}]];
		var prefix = ctx + "system/dict";
		var dictId = $("#dictId").val();
		$(function() {
			var options = {
		        url: prefix + "/list?category=2",
		        sortName: "createTime",
		        sortOrder: "desc",
		        modalName: "用户",
		        showSearch: false,
		        showRefresh: false,
		        showToggle: false,
		        showColumns: false,
		        clickToSelect: true,
		        rememberSelected: true,
				columns: [{
					radio: true,
					formatter: function(value, row, index) {
						return {
							checked: row.dictId == dictId
						}
					}
				},
				{
					field: 'dictId',
					title: '字典主键'
				},
				{
					field: 'dictName',
					title: '字典名称'
				},
				{
					field: 'dictType',
					title: '字典类型'
				}]
		    };
		    $.table.init(options);
		});

		function submitHandler() {
			var rows = $.table.selectFirstColumns();
			if (rows.length == 0) {
       			return 0;
       		}
			return rows[0];
		}
	</script>
</body>
</html>